package com.yl.chainStore.util

import ij.plugin.DICOM
import java.awt.image.BufferedImage
import java.io.File
import javax.imageio.ImageIO

class DcmToImageUtil {
    /**
     * 输入一个dicom文件的绝对路径和名字
     * 获取一个jpg文件
     */
    fun create2(filePath: String) {
        try {
            val dicom = DICOM()
            dicom.run(filePath)
            val bi = dicom.image as BufferedImage
            val imagePath = "$filePath.jpg"
            ImageIO.write(bi, "jpg", File(imagePath))
            println(imagePath)
        } catch (e: Exception) {
            throw Exception("文件类型转换失败")
        }
    }
}
